package com.langll.ai.controller.request;

import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import lombok.Data;

/**
 * @author langll
 * @des AI生成请求参数
 * @date 2025/6/4
 */
@Data
@JsonIgnoreProperties(ignoreUnknown = true)
public class GenerateRequest {
    
    private String sessionId;
    private String userId;
    
    private String model;
    
    private String prompt;
    
    private Boolean stream;
    
    private OptionsRequest options;
    
    @Data
    @JsonIgnoreProperties(ignoreUnknown = true)
    public static class OptionsRequest {
        private ParametersRequest parameters;
        
        // 为了兼容性，也支持直接在 options 级别接收参数
        private Double temperature;
        
        @JsonProperty("top_k")
        private Integer topK;
        
        @JsonProperty("top_p")
        private Double topP;
        
        @JsonProperty("repeat_penalty")
        private Double repeatPenalty;
    }
    
    @Data
    @JsonIgnoreProperties(ignoreUnknown = true)
    public static class ParametersRequest {
        private Double temperature;
        
        @JsonProperty("top_k")
        private Integer topK;
        
        @JsonProperty("top_p")
        private Double topP;
        
        @JsonProperty("repeat_penalty")
        private Double repeatPenalty;
    }
}
